<?php 

/**
* 
*/

class UsersController extends AppController {

	var $components = array('RequestHandler');
	
	function index() {
    	$users = $this->User->find('all');
    	$this->set(compact('users'));    	
	}

	function view($id) {
		$user = $this->User->findById($id);
		$this->set(compact('user'));
	}

	function edit($id) {
		$this->User->id = $id;
		if ($this->User->save($this->data)) {
			$message = 'Saved';
		} else {
			$message = 'Error';
		}
		$this->set(compact('message'));
  	}

	function delete($id) {
		if($this->User->delete($id)) {
			$message = 'Deleted';
		} else {
			$message = 'Error';
		}
		$this->set(compact('message'));
	}
}


?>